import logging

import yaml


def getdatafromyaml(filepath):
    with open(filepath, 'r', encoding='utf-8') as f:
        return yaml.safe_load(f)


def log_set():
    #filemode w+覆盖 a+追加
    #level采集日志最低级别
    #日志级别 DEBUG->INFO->WARNING->ERROR->CRITICAL
    logging.basicConfig(filename='wmslog.txt',filemode='a+',level=logging.DEBUG,format="%(asctime)s -> %(levelname)s -> %(message)s")


#pip install yafmail
#发送邮件
import yagmail
def send_mail(filepath):
    mail=yagmail.SMTP(user='1454fewrr4@qq.com',password="授权码",host="smtp.qq.com")
    mail.send(to='sdfdgh@qq.com',subject="测试报告：xxxf",contents="内容",attachments=filepath)












